package cn.edu.scnu.semart.order.controller;

import cn.edu.scnu.semart.common.result.Result;
import cn.edu.scnu.semart.order.service.OrderStatService;
import cn.edu.scnu.semart.vo.order.RegionSalesVO;
import cn.edu.scnu.semart.vo.order.TradeDailyVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/stat/order")
@RequiredArgsConstructor
public class OrderStatController {

    private final OrderStatService orderStatService;

    // 地域销量
    @GetMapping("/region-sales")
    public Result<List<RegionSalesVO>> regionSales() {
        return Result.ok(orderStatService.regionSales());
    }

    // 交易数据趋势
    @GetMapping("/trade-daily")
    public Result<List<TradeDailyVO>> tradeDaily() {
        return Result.ok(orderStatService.tradeDaily());
    }
}